﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script src="../script/jquery.min.js"></script>
    <script src="../script/jquery.easyui.min.js"></script>
    <link href="../themes/default/easyui.css" rel="stylesheet" />
    <link href="../themes/icon.css" rel="stylesheet" />
    <link href="../themes/Site.css" rel="stylesheet" />
    <script type="text/javascript">
       $(function (){
           $('#dg').datagrid({
               fitColumns: true,
               pagination: true,
               //fit: true,
               singleSelect: true,
               rownumbers:true,
               url: '../Json/datagrid_data1.json',
               method: 'get',
           columns: [[
               { field: 'productid', title: '礼品编号', width: 100 },
               { field: 'itemid', title: '礼品代号', width: 100 },
               { field: 'productname', title: '店铺名称', width: 100, align: 'right' },
           { field: 'unitcost', title: '所需积分', width: 100, align: 'right' },
       { field: 'listprice', title: '礼品数量', width: 100, align: 'right' },
       { field: 'listprice', title: '已兑换数量', width: 100, align: 'right' },
       { field: 'attr1', title: '备注', width: 100, align: 'right' },
           ]]
           });
           $("#add").click(function () {

                   $("#dig").dialog({ width: 400, height: 400 }).dialog("setTitle", "新增礼品").dialog("open");
                   $("#frm1").attr("src", "presentAdd.html");

           })

           $("#update").click(function () {
               var row = $("#dg").datagrid("getSelected");
               if (row!=null) {
                   $("#dig").dialog({ width: 400, height: 400 }).dialog("setTitle", "修改店铺").dialog("open");
                   $("#frm1").attr("src", "presentupdate.html");
               } else {
                   $.messager.alert("提示", "请选择要编辑的行", "warning");
               }
           })
           $("#delete").click(function () {
               var row = $("#dg").datagrid("getSelected");
               if (row != null) {
                   $.messager.confirm('确认', '您确认想要删除选中的信息吗？', function (r) {
                       if (r) {
                           alert('确认删除');
                       }
                   });
               } else {
                   $.messager.alert("提示", "请选择要删除的行", "warning");
               }
           })
          

       })

       </script>
</head>
<body>
    <div id="tb" style="padding:5px;height:auto">

        <div style="margin-bottom:5px">
            <a id="add" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'">新增</a>
            <a id="update" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit'">修改</a>
            <a id="delete" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">删除</a>
        </div>

        <table id="dg"></table>

    </div>
    <div id="dig">
        <iframe id="frm1" width="99%" height="99%" frameborder="0" scrolling="no"></iframe>
    </div>
</body>
</html>
